package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.internetofthings.firefightingiot;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.internetofthings.firefightingiot.FireDeviceService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 设备控制器
 */
@Action
@RequestMapping(value="fireFightingIOT/device")
public class FireDeviceController extends BaseController {
    @Resource
    public FireDeviceService fireDeviceService;

    /**
     * 设备添加
     * @param
     * name	设备名称
     * number	设备编号
     * internetofthingsCardnum	物联网卡号
     * transDeviceCode	传输装置编码
     * deviceType	设备类型id
     * installtime	安装日期
     * position	安装位置
     * lon	经度
     * lat	纬度
     * img	设备图片
     * productId	产品id
     * spec	规格
     * alarmPhone	报警电话
     * installperson	安装人员
     * installpersonPhone	安装人员电话
     * deviceClassify	设备分类:1 电气火灾 2 消防用水 3 烟感 4 可燃气体 5 火灾自动联网 6 消防可视化
     * businessId	单位id
     * businessName	单位名称
     * id	主键id
     * rfid	RFID码
     * remark	备注
     * @return
     */
    @At(value = "add", method = RequestMethod.POST, param = { "deviceClassify","businessId","businessName" })
    public RespEntity add(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.add(jsonParam);
    }

    /**
     * 设备删除
     * @param
     * id	设备的id
     * @return
     */
    @At(value = "delete", method = RequestMethod.POST, param = { "id"})
    public RespEntity delete(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.delete(jsonParam);
    }

    /**
     * 设备修改
     * @param
     * name	设备名称
     * number	设备编号
     * internetofthingsCardnum	物联网卡号
     * transDeviceCode	传输装置编码
     * deviceType	设备类型id
     * installtime	安装日期
     * position	安装位置
     * lon	经度
     * lat	纬度
     * img	设备图片
     * productId	产品id
     * spec	规格
     * alarmPhone	报警电话
     * installperson	安装人员
     * installpersonPhone	安装人员电话
     * deviceClassify	设备分类:1 电气火灾 2 消防用水 3 烟感 4 可燃气体 5 火灾自动联网 6 消防可视化
     * businessId	单位id
     * businessName	单位名称
     * id	设备id
     * rfid	RFID码
     * remark	备注
     * @return
     */
    @At(value = "update", method = RequestMethod.POST, param = { "deviceClassify","businessId","businessName","id" })
    public RespEntity update(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.update(jsonParam);
    }

    /**
     * 设备列表
     * @param
     * page	第几页
     * limit	每页多少条
     * deviceClassify	设备分类:对应字典表设备分类
     * businessName	单位名称(模糊查询)
     * position	位置（模糊查询）
     * number	设备编号(模糊查询)
     * rfid	RFID码	否
     * @return
     */
    @At(value = "deviceListPage", method = RequestMethod.GET, param = { "page","limit" })
    public RespEntity deviceListPage(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceListPage(jsonParam);
    }

    /**
     * 设备详情
     * @param  id	设备id
     * rfid	RFID码	否
     * number	设备编号	否
     * @return
     */
    @At(value = "detail", method = RequestMethod.GET)
    public RespEntity detail(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.detail(jsonParam);
    }

    /**
     * 设备正常数据查询
     * @param
     * deviceClassify    设备分类:1 电气火灾 2 消防用水 3 烟感 4 可燃气体 5 火灾自动联网 6 消防可视化
     * deviceId	设备id
     * time	设备发送时间
     * tabflag	"电气火灾时：
     * 所属tab:1 基本电参数 2 电力检测参数 3 其他参数;其他物联网：前端都传1
     * id 电气火灾--其他参数里筛选不同列表项的数据用
     * @return
     */
    @At(value = "normalDataLogList", method = RequestMethod.POST, param = { "deviceClassify","deviceId","time","tabflag" })
    public RespEntity normalDataLogList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.normalDataLogList(jsonParam);
    }

    /**
     * 电气火灾其他参数列表
     * @param
     * @return
     */
    @At(value = "eleNormalOtherList", method = RequestMethod.GET)
    public RespEntity eleNormalOtherList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.eleNormalOtherList(jsonParam);
    }

    /**
     * 产品列表
     * @param
     * @return
     */
    @At(value = "productList", method = RequestMethod.GET, param = { "type" })
    public RespEntity productList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.productList(jsonParam);
    }
    /**
     * 单位摄像头设备列表
     * @param
     * @return
     */
    @At(value = "deviceCameraList", method = RequestMethod.GET)
    public RespEntity deviceCameraList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceCameraList(jsonParam);
    }

    /**
     * 查询单位下的led,ip音柱，鹰眼e通设备列表
     * @param
     * @return
     */
    @At(value = "deviceList", method = RequestMethod.GET)
    public RespEntity deviceList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceList(jsonParam);
    }

    /**
     * 查询单位下的led,ip音柱，鹰眼e通设备列表（new）
     * @param
     * @return
     */
    @At(value = "deviceListNew", method = RequestMethod.POST)
    public RespEntity deviceListNew(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceListNew(jsonParam);
    }

    /**
     * 卸油证据链分页列表
     * @param
     * @return
     */
    @At(value = "getChainOfEvidencePageList", method = RequestMethod.GET)
    public RespEntity getChainOfEvidencePageList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getChainOfEvidencePageList(jsonParam);
    }

    /**
     * 海康梯控远程关门
     * @param
     * @return
     */
    @At(value = "remoteClosing", method = RequestMethod.POST)
    public RespEntity remoteClosing(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.remoteClosing(jsonParam);
    }

    /**
     * 平台列表
     * @param
     * @return
     */
    @At(value = "platformList", method = RequestMethod.GET)
    public RespEntity platformList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.platformList(jsonParam);
    }

    /**
     * 功能列表
     * @param
     * @return
     */
    @At(value = "functionList", method = RequestMethod.GET)
    public RespEntity functionList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.functionList(jsonParam);
    }

    /**
     * 今日每个时刻的报警数目统计
     * @param
     * @return
     */
    @At(value = "todayNormalDataLogNumByMin", method = RequestMethod.GET, param = { "deviceClassify" })
    public RespEntity todayNormalDataLogNumByMin(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.todayNormalDataLogNumByMin(jsonParam);
    }

    /**
     * 设备类型列表
     * @param
     * @return
     */
    @At(value = "deviceTypeList", method = RequestMethod.GET, param = { "type" })
    public RespEntity deviceTypeList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceTypeList(jsonParam);
    }

    /**
     * 设备操作分类功能：添加
     * @param
     * @return
     */
    @At(value = "typeAdd", method = RequestMethod.POST, param = { "deviceClassify"})
    public RespEntity typeAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.typeAdd(jsonParam);
    }

    /**
     * 设备操作分类功能：修改
     * @param
     * @return
     */
    @At(value = "typeUpdate", method = RequestMethod.POST, param = { "deviceClassify","id"})
    public RespEntity typeUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.typeUpdate(jsonParam);
    }

    /**
     * 设备操作分类功能：删除
     * @param
     * @return
     */
    @At(value = "typeDelete", method = RequestMethod.POST, param = { "deviceClassify","id"})
    public RespEntity typeDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.typeDelete(jsonParam);
    }

    /**
     * 设备绑定openid
     * @param jsonParam
     * @return
     */
    @At(value = "deviceWechat", method = RequestMethod.POST, param = { "number","openid"})
    public RespEntity deviceWechat(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceWechat(jsonParam);
    }

    /**
     * 查询Rtmp视频流
     * @param jsonParam
     * @return
     */
    @At(value = "getRtmp", method = RequestMethod.GET, param = { "number"})
    public RespEntity getRtmp(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getRtmp(jsonParam);
    }
    /**
     * 查询海康Rtsp视频流
     * @param jsonParam
     * @return
     */
    @At(value = "getHKRtsp", method = RequestMethod.GET, param = { "number"})
    public RespEntity getRtsp(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getHKRtsp(jsonParam);
    }
    /**
     * 查询海康Rtmp视频流
     * @param jsonParam
     * @return
     */
    @At(value = "getHKRtmp", method = RequestMethod.GET, param = { "number"})
    public RespEntity getHKRtmp(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getHKRtmp(jsonParam);
    }
    /**
     * 查询Rtsp语音流
     * @param jsonParam
     * @return
     */
    @At(value = "getTalkRtsp", method = RequestMethod.GET, param = { "number"})
    public RespEntity getTalkRtsp(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getTalkRtsp(jsonParam);
    }

    /**
     * 拉取直播视频流
     * @param jsonParam
     * @return
     */
    @At(value = "getLiveStream", method = RequestMethod.GET, param = { "number"})
    public RespEntity getLiveStream(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getLiveStream(jsonParam);
    }
    /**
     * 拉取回放视频流
     * @param jsonParam
     * @return
     */
    @At(value = "getPlaybackStream", method = RequestMethod.GET, param = { "number"})
    public RespEntity getPlaybackStream(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getPlaybackStream(jsonParam);
    }
    /**
     * 远程控制分合闸
     * @param jsonParam
     * @return
     */
    @At(value = "openIssued", method = RequestMethod.POST, param = { "number","type"})
    public RespEntity openIssued(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.openIssued(jsonParam);
    }
    /**
     * 根据单位获取明厨亮灶设备
     * @param jsonParam
     * @return
     */
    @At(value = "getBrightKitchenDevice", method = RequestMethod.GET)
    public RespEntity getBrightKitchenDevice(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getBrightKitchenDevice(jsonParam);
    }

    /**
     * 根据机构获取明厨亮灶设备
     * @param jsonParam
     * @return
     */
    @At(value = "getOrgBrightKitchenDevice", method = RequestMethod.GET)
    public RespEntity getOrgBrightKitchenDevice(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getOrgBrightKitchenDevice(jsonParam);
    }
    /**
     * 加油站设备通道列表
     * @param jsonParam
     * @return
     */
    @At(value = "deviceChannelList", method = RequestMethod.GET)
    public RespEntity deviceChannelList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceChannelList(jsonParam);
    }
    /**
     * 加油站设备通道删除
     * @param jsonParam
     * @return
     */
    @At(value = "deviceChannelDel", method = RequestMethod.POST, param = { "id"})
    public RespEntity deviceChannelDel(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceChannelDel(jsonParam);
    }
    /**
     * 加油站设备通道新增、编辑
     * @param jsonParam
     * @return
     */
    @At(value = "deviceChannelAddOrUpdate", method = RequestMethod.POST)
    public RespEntity deviceChannelAddOrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceChannelAddOrUpdate(jsonParam);
    }

    /**
     * 设备与监控新增、编辑绑定
     * @param jsonParam
     * @return
     */
    @At(value = "deviceCameraBindingAddOrUpdate", method = RequestMethod.POST)
    public RespEntity deviceCameraBindingAddOrUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceCameraBindingAddOrUpdate(jsonParam);
    }

    /**
     * 删除
     * @param jsonParam
     * @return
     */
    @At(value = "deviceCameraBindingDel", method = RequestMethod.POST)
    public RespEntity deviceCameraBindingDel(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceCameraBindingDel(jsonParam);
    }

    /**
     * 设备与监控绑定列表
     * @param jsonParam
     * @return
     */
    @At(value = "deviceCameraBindingList", method = RequestMethod.GET)
    public RespEntity deviceCameraBindingList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.deviceCameraBindingList(jsonParam);
    }

    /**
     * 电信AEP盛善电设备下发指令
     * @param jsonParam
     * @return
     */
    @At(value = "createCommand", method = RequestMethod.POST)
    public RespEntity createCommand(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.createCommand(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 电能数据(单个设备查询)
     * @Date Created in 16:11 2023/3/2
     * @Param [jsonParam]
     */

    @At(value = "electricEnergyList", method = RequestMethod.GET, param = { "number" })
    public RespEntity electricEnergyList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.electricEnergyList(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 电正常数据详情
     * @Date Created in 16:11 2023/3/2
     * @Param [jsonParam]
     */

    @At(value = "getElectricDataDetails", method = RequestMethod.GET, param = { "number" })
    public RespEntity getElectricDataDetails(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getElectricDataDetails(jsonParam);
    }

    /**
     * 获取视频流
     * @param jsonParam
     * @return
     */
    @At(value = "getVideoStream", method = RequestMethod.GET, param = { "number"})
    public RespEntity getVideoStream(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getVideoStream(jsonParam);
    }
    /**
     * 关闭视频流
     * @param jsonParam
     * @return
     */
    @At(value = "closeVideoStream", method = RequestMethod.GET, param = { "number"})
    public RespEntity closeVideoStream(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.closeVideoStream(jsonParam);
    }

    /**
     * 小程序、APP设备统计模块
     * @param jsonParam
     * @return
     */
    @At(value = "getDeviceCountApp", method = RequestMethod.GET)
    public RespEntity getDeviceCountApp(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getDeviceCountApp(jsonParam);
    }

    /**
     * 获取水柱箱体数据
     * @param jsonParam
     * @return
     */
    @At(value = "getWaterColumnBoxData", method = RequestMethod.GET, param = { "number"})
    public RespEntity getWaterColumnBoxData(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getWaterColumnBoxData(jsonParam);
    }

    /**
     * 水柱箱体下发指令
     * @param jsonParam
     * @return
     */
    @At(value = "setWaterColumnBoxData", method = RequestMethod.POST)
    public RespEntity setWaterColumnBoxData(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.setWaterColumnBoxData(jsonParam);
    }

    /**
     * 获取水柱箱体历史数据
     * @param jsonParam
     * @return
     */
    @At(value = "waterColumnBoxDataLogList", method = RequestMethod.GET, param = { "number"})
    public RespEntity waterColumnBoxDataLogList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.waterColumnBoxDataLogList(jsonParam);
    }

    /**
     * sos通讯录新增、编辑
     * @param jsonParam
     * @return
     */
    @At(value = "addOrUpdateBook", method = RequestMethod.POST)
    public RespEntity addOrUpdateBook(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.addOrUpdateBook(jsonParam);
    }

    /**
     * sos通讯录列表
     * @param jsonParam
     * @return
     */
    @At(value = "sosAddressBookList", method = RequestMethod.GET)
    public RespEntity sosAddressBookList(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.sosAddressBookList(jsonParam);
    }

    /**
     * 设置视频设备播放时间
     * @param jsonParam
     * @return
     */
    @At(value = "setVideoPlayTime", method = RequestMethod.POST)
    public RespEntity setVideoPlayTime(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.setVideoPlayTime(jsonParam);
    }

    /**
     * 获取视频设备播放时间
     * @param jsonParam
     * @return
     */
    @At(value = "getVideoPlayTime", method = RequestMethod.GET)
    public RespEntity getVideoPlayTime(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getVideoPlayTime(jsonParam);
    }

    /**
     * 更新视频设备播放时间
     * @param jsonParam
     * @return
     */
    @At(value = "updateVideoPlayTime", method = RequestMethod.POST)
    public RespEntity updateVideoPlayTime(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.updateVideoPlayTime(jsonParam);
    }


    /**
     * @Author YangYu
     * @Description 手动更新设备状态
     * @Date Created in 13:46 2024/1/10
     * @Param [jsonParam]
     */

    @At(value = "updateDeviceState", method = RequestMethod.POST)
    public RespEntity updateDeviceState(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.updateDeviceState(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 获取气体灭火系统数据
     * @Date Created in 11:22 2024/4/3
     * @Param [jsonParam]
     */

    @At(value = "getGasFireExtinguishingData", method = RequestMethod.GET)
    public RespEntity getGasFireExtinguishingData(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.getGasFireExtinguishingData(jsonParam);
    }

    /**
     * @Author YangYu
     * @Description 物联网平台远程下发指令
     * @Date Created in 16:56 2024/12/17
     * @Param [jsonParam]
     */

    @At(value = "iotPost", method = RequestMethod.POST)
    public RespEntity iotPost(@RequestBody(required = false) JSONObject jsonParam) {
        return fireDeviceService.iotPost(jsonParam);
    }

}
